package com.backflash.client;


import com.backflash.client.bean.User;
import com.backflash.client.screens.LoginScreen;
import com.backflash.client.screens.ThreadScreen;
import com.backflash.client.screens.UserScreen;
import com.backflash.client.screens.StartScreen;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class BackFlash implements EntryPoint{
    private static BackFlash singleton;
    
    public static BackFlash get() {
	return singleton;
    }
    
    @Override
	public void onModuleLoad() {
        singleton=this;
        setStartScreen();
    }
    
    /**
     * Method to set the home page
     * @param user
     */
     public void setUserScreen()    {
       UserScreen userScreen=new UserScreen();
         /**
         * Clear whatever is on the screen
         */
       RootPanel.get().clear();
         /**
         * Replace it with this home screen
         */
       RootPanel.get().add(userScreen);
     }
     
     /**
      * Method to set the start page
      */
      public void setStartScreen()    {
        StartScreen startScreen=new StartScreen();
          /**
          * Clear whatever is on the screen
          */
        RootPanel.get().clear();
          /**
          * Replace it with this home screen
          */
        RootPanel.get().add(startScreen);
      }
      
      /**
       * Method to set the home page
       * @param user
       */
       public void setThreadScreen(String topic)    {
         ThreadScreen threadScreen = new ThreadScreen(topic);
           /**
           * Clear whatever is on the screen
           */
         RootPanel.get().clear();
           /**
           * Replace it with this home screen
           */
         RootPanel.get().add(threadScreen);
       }
       
       public void setLoginScreen(){
    	   LoginScreen loginScreen = new LoginScreen();
    	   RootPanel.get().clear();
    	   RootPanel.get().add(loginScreen);
       }
}